package com.bbcare.followup.plat.service.impl;


import com.bbcare.followup.plat.entity.HisIdMapper;
import com.bbcare.followup.plat.service.HisIdMapperService;
import com.bbcare.followup.plat.store.ibatis.HisIdMappingDAO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


@Service
public class HisIdMapperServiceImpl implements HisIdMapperService {
    @Autowired
    private HisIdMappingDAO dao;

    @Override
    public int save(String followupPatId, String xmPatId) throws Exception {
        HisIdMapper oneMapper = new HisIdMapper();
        oneMapper.setFollowupPatId(followupPatId);
        oneMapper.setHisPatId(xmPatId);
        return dao.save(oneMapper);
    }

    @Override
    public String selectByFuId(final String followupPatId) throws Exception {
        HisIdMapper mapper = dao.selectById(followupPatId);
        String xmHisId  = null;
        if (null!=mapper && null!=mapper.getHisPatId())   {
            xmHisId = mapper.getHisPatId();
        }

        return xmHisId;
    }

}
